package com.xiaobing.crm.controller;

import com.xiaobing.common.annotation.UserOptLogger;
import com.xiaobing.common.res.Result;
import com.xiaobing.crm.entity.UserEntity;
import com.xiaobing.crm.feign.usercenter.UserCenterFeign;
import com.xiaobing.crm.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 分享 前端控制器
 * </p>
 *
 * @author tui
 * @since 2024-07-16
 */
@Slf4j
@RestController
@Tag(name = "feign-user模块")
@RequestMapping("/crm/test")
public class UserController {

    @Resource
    private UserService userService;

    @Resource
    private UserCenterFeign userCenterFeign;

    //  /crm/test/1
    @UserOptLogger(operation = "获取用户信息", save = false)
    @Operation(summary = "获取用户信息", description = "")
    @GetMapping("/{id}")
    public Result<UserEntity> findById(@PathVariable Integer id) {
        Result<UserEntity> byId = userCenterFeign.findById(id);
        return byId;
    }

}
